﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using HA.ModFlow.Infrastructure;

namespace HA.ModFlow.Controls.UserControls
{
    /// <summary>
    /// ucMultiInput.xaml 的交互逻辑
    /// </summary>
    public partial class ucMultiInput:UserControl
    {
        public ucMultiInput()
        {
            InitializeComponent();

            //ucMultiInput.PropertyChanged += new EventHandler(ucMultiInput_PropertyChanged);
        }

        void ucMultiInput_PropertyChanged(object sender, EventArgs e)
        {
            //this.DataContext = SPData;
        }

        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {

            List<double> lst = (List<double>)this.DataContext;

            winMultiInput win = new winMultiInput(lst);

         
           

           
            //win.Owner = this.Parent;
            win.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            win.Owner = mainWindow;
            if (win.ShowDialog() == true)
            {
                this.txtnumber.GetBindingExpression(TextBox.TextProperty).UpdateTarget();

                this.txtnumber.GetBindingExpression(TextBox.IsEnabledProperty).UpdateTarget();


            }



            //MessageBox.Show(lst[0].ToString ());

        }

        public static Window mainWindow;

        //static ucMultiInput()
        //{

        //    FrameworkPropertyMetadata mete = new FrameworkPropertyMetadata();
        //    mete.DefaultValue = new List<double>();
        //    mete.PropertyChangedCallback += OnPropertyChanged;
            
        //    mete.Inherits = true;

        //    spData = DependencyProperty.Register("SPData", typeof(List<double>), typeof(ucMultiInput), mete);

        //}


        //public static readonly DependencyProperty spData;


        //public List<double> SPData
        //{

        //    get { return (List<double>)GetValue(spData); }

        //    set { SetValue(spData, value); }
        //}


        //public static event EventHandler PropertyChanged;

        //static void OnPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        //{
        //    if (PropertyChanged != null)
        //    {
        //        PropertyChanged(null, new EventArgs());
        //    }
        //}

    }
}
